//
//  SNAllNotifyModel.m
//  app
//
//  Created by 王少宁 on 15/9/8.
//  Copyright (c) 2015年 hdaren. All rights reserved.
//

#import "SNAllNotifyModel.h"

@implementation SNAllNotifyModel

- (instancetype)initWithDict:(NSDictionary *)dict
{
    if ([super init]) {
        _iD = [dict[@"id"] stringValue];
        _isTop = [dict[@"isTop"] boolValue];
        _typeName = dict[@"typeName"];
        _title = dict[@"title"];
        _views = [dict[@"views"] stringValue];
        _url = dict[@"url"];
        NSString * createTime = [dict[@"createtime"] stringValue];
        _createtime = [self createTimeWithStr:createTime];
    }
    return self;
}

+ (instancetype)modelWithDict:(NSDictionary *)dict
{
    return [[self alloc] initWithDict:dict];
}

- (NSString *)createTimeWithStr:(NSString *)str
{
    NSDate * date = [NSDate dateWithTimeIntervalSince1970:[str floatValue]];
    NSDateFormatter * formatter = [[NSDateFormatter alloc] init];
    formatter.dateFormat = @"MM-dd HH:mm";
    NSString * dateStr = [formatter stringFromDate:date];
    return dateStr;
}

@end
